package com.daniu.demo.jdk.collection;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;

public class TreeMapDemo {

    public static void main(String[] args) {
        Map<Integer, String> map = new TreeMap<Integer, String>();
        map.put(3, "c");
        map.put(1, "a");
        map.put(2, "b");
        Iterator<Map.Entry<Integer, String>> iterator = map.entrySet().iterator();
        for (; iterator.hasNext(); ) {
            Map.Entry<Integer, String> entry = iterator.next();
            System.out.println(entry);
        }
    }
}
